//
//  SchoolDetailController.m
//  EducationAdminClient
//
//  Created by KWSD on 15/12/5.
//  Copyright © 2015年 周佳兴. All rights reserved.
//

#import "SchoolDetailController.h"
#import "ListDetailCell.h"
@interface SchoolDetailController ()

@end

@implementation SchoolDetailController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.tbView = [[UITableView alloc]init];
    [self.view addSubview:self.tbView];
    self.tbView.dataSource = self;
    self.tbView.delegate = self;
    
    [self createLeftNavBar];
    
    [self.tbView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view.mas_left);
        make.right.equalTo(self.view.mas_right);
        make.top.equalTo(self.view.mas_top);
        make.bottom.equalTo(self.view.mas_bottom);
    }];
    NSLog(@"%@",_itemDic);
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return _itemDic.count;
    
}



- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    static NSString *str = @"identifier";
    ListDetailCell *cell = [tableView dequeueReusableCellWithIdentifier:str];
    if(cell==nil){
        cell = [[ListDetailCell alloc]initWithReuseIdentifier:str];
    }
    NSDictionary *dic = [_fieldArr objectAtIndex:indexPath.row];
    if([dic objectForKey:@"fieldCnName"]){
        
        cell.title.text = [dic objectForKey:@"fieldCnName"];
    }
    if([_itemDic objectForKey:[dic objectForKey:@"fieldAliasName"]]){
        
        cell.titleText.text =[NSString stringWithFormat:@"%@",[_itemDic objectForKey:[dic objectForKey:@"fieldAliasName"]]];
    }
    cell.titleText.userInteractionEnabled = NO;
    return cell;
    
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    
//    SchoolDetailController *sv = [[SchoolDetailController alloc]init];
//    [self.navigationController pushViewController:sv animated:YES];
//    sv.fieldArr = _schoolFieldArr;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 50;
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
